package cn.kgc.comment.service;

import cn.kgc.comment.mapper.CommentMapper;
import cn.kgc.common.entity.Article;
import cn.kgc.common.entity.Comment;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by teacher ZHANG on 2022/11/23
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements CommentService {
    @Override
    public List<Map<String, Object>> listTopComments(Integer num) {
        return getBaseMapper().selectTopComments(num);
    }

    @Override
    public List<Map<String, Object>> listCounts(List<Integer> idList) {
        return getBaseMapper().selectCountByList(idList);
    }

    @Override
    public Integer saveComment(Comment comment) {
        return getBaseMapper().insertComment(comment);
    }
}
